//
//  OHttp.h
//  soccer
//
//  Created by 上官千城 on 15/9/18.
//  Copyright (c) 2015年 上官千城. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "OHttpSession.h"
#import "OErrorCode.h"
#import "AFNetworking.h"
#define ERC @"ERC"

#define HOST @"192.168.1.103"
#define PORT 9099

#define CODE_OK 200


@protocol OLogicRun <NSObject>

-(void)run:(NSData*)data erc:(NSInteger)erc;

@end

typedef enum
{
    GET ,
    POST
}method;

@interface ONet : NSObject
{
    
@private NSString* _url;
@private NSDictionary* _params;
@private NSMutableDictionary* _requestHeads;
@private Method _method;
@private NSData* _reqData;
    
@private __block BOOL _isDone;
@private __block NSInteger _httpCode;
@private __block NSInteger _erc;
@private __block NSData* _respData;
}
-(BOOL) syncSend;
-(void) asynSend:(id<OLogicRun>) myDelegate;
-(BOOL) isDone;
-(Method) getMethod;
-(NSInteger) getErc;
-(NSData*) getRespData;
-(instancetype) initWithMethod:(Method)method url:(NSString *)url params:(NSDictionary*)params reqData:(NSData*)reqData;



@end
